![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
unist-util-modify-children
Advanced tools
Modify direct children of a parent.
npm:
npm install unist-util-modify-children
var u = require('unist-builder')
var modifyChildren = require('unist-util-modify-children')
var modify = modifyChildren(modifier)
var tree = u('root', [
u('leaf', '1'),
u('node', [u('leaf', '2')]),
u('leaf', '3')
])
modify(tree)
console.dir(tree, {depth: null})
function modifier(node, index, parent) {
if (node.type === 'node') {
parent.children.splice(index, 1, {type: 'subtree', children: node.children})
return index + 1
}
}
Yields:
{
type: 'root',
children: [
{type: 'leaf', value: '1'},
{type: 'subtree', children: [{type: 'leaf', value: '2'}]},
{type: 'leaf', value: '3'}
]
}
modify = modifyChildren(modifier)
Wrap modifier
to be invoked for each child in the node given to
modify
.
next? = modifier(child, index, parent)
Invoked if modify
is called on a parent node for each child
in parent
.
number
(optional) — Next position to iterate.
function modify(parent)
Invoke the bound modifier
for each child in parent
(Node
).
unist-util-visit
— Recursively walk over nodesunist-util-visit-parents
— Like visit
, but with a stack of parentsunist-util-filter
— Create a new tree with all nodes that pass a testunist-util-map
— Create a new tree with all nodes mapped by a given functionunist-util-flatmap
— Create a new tree by mapping (to an array) with the provided function and
then flatteningunist-util-find-after
— Find a node after another nodeunist-util-find-before
— Find a node before another nodeunist-util-find-all-after
— Find all nodes after another nodeunist-util-find-all-before
— Find all nodes before another nodeunist-util-find-all-between
— Find all nodes between two nodesunist-util-remove
— Remove nodes from a tree that pass a testunist-util-select
— Select nodes with CSS-like selectorsSee contributing.md
in syntax-tree/.github
for ways to get
started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
FAQs
unist utility to modify direct children of a parent
The npm package unist-util-modify-children receives a total of 0 weekly downloads. As such, unist-util-modify-children popularity was classified as not popular.
We found that unist-util-modify-children demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.